package com.magnusart.scrumppm.learning;




//Send questions, comments, bug reports, etc. to the authors:

//Rob Warner (rwarner@interspatial.com)
//Robert Harris (rbrt_harris@yahoo.com)

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;


public class LearningSWTGroups
{


	/**
	 * This class demonstrates groups
	 */
	  public static void main(String[] args) {
	    Display display = new Display();
	    Shell shell = new Shell(display);
	    shell.setLayout(new GridLayout());

	    // Create the first group
	    Group group1 = new Group(shell, SWT.SHADOW_IN);
	    group1.setText("Who's your favorite?");
	    group1.setLayout(new RowLayout(SWT.VERTICAL));
	    new Button(group1, SWT.RADIO).setText("John");
	    new Button(group1, SWT.RADIO).setText("Paul");
	    new Button(group1, SWT.RADIO).setText("George");
	    new Button(group1, SWT.RADIO).setText("Ringo");

	    // Create the second group
	    Group group2 = new Group(shell, SWT.NO_RADIO_GROUP);
	    group2.setText("Who's your favorite?");
	    RowLayout rl = new RowLayout(SWT.VERTICAL);
	    rl.fill = true;
	    group2.setLayout(rl);
	    new Button(group2, SWT.RADIO).setText("Barry");
	    new Button(group2, SWT.RADIO).setText("Robin");
	    new Button(group2, SWT.RADIO).setText("Maurice");
	    
	    List list = new List( group2, SWT.SINGLE );
	    list.setItems( new String[] { "Första", "Andra", "Tredje" } );
	    
	    shell.pack();
	    shell.open();
	    
	    while (!shell.isDisposed()) {
	      if (!display.readAndDispatch()) {
	        display.sleep();
	      }
	    }
	    display.dispose();
	  }
	}
